﻿<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8" />
<link href="weixin/css/layer.css" rel="stylesheet" />
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="css/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
<link href="css/font-awesome.min.css" rel="stylesheet" />
<script src="js/jquery-2.1.1.min.js"></script>
<script src="js/plugins/layer/layer.min.js"></script>
<script src="js/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script src="weixin/js/common.js"></script>
<style>
    #report {
        font-size: 15px;
        height: auto;
        width: auto;
        text-align: center;
        margin-top:5px
    }
    #report th {
        background-color: darkgrey;
        text-align: center !important;
        min-width: 100px
    }
    .red {
        font-weight: bold;
        color: red;
        background-color: wheat;
        border-color: black;
    }
    .black {
        color: black;
        font-weight: bold;
        background-color: wheat;
    }
</style>
<html>
<head>
    <title>时段销售分析报表二</title>
</head>
<body>
<div style="margin-top:5px;margin-left:5px">
    <div>
        <label>时间一:</label>&nbsp&nbsp
        <input id="endDate1" type="text" placeholder="请选择结束时间一" readonly="readonly" />
        <label>时间二:</label>&nbsp&nbsp
        <input id="endDate2" class="input-date" type="text" placeholder="请选择结束时间二" readonly="readonly" />
        <label>时间三:</label>&nbsp&nbsp
        <input id="endDate3" class="input-date" type="text" placeholder="请选择结束时间三" readonly="readonly" />
        <label>店铺类型:</label>&nbsp&nbsp
        <select id="shopType">
            <option value="0">全部</option>
            <option value="1">常规店、低价店</option>
            <option value="2">奥莱店、折扣店</option>
        </select>
        <a class="btn btn-success btn-xs btn-lg">查询</a>
    </div>
    <table border="1" id="report">
        <thead id="title">
        <%--<tr >
            <th>项目</th>
            <th>日期</th>
            <th>星期</th>
            <th>零售1部</th>
            <th>零售2部</th>
            <th>零售3部</th>
            <th>零售4部</th>
            <th>零售5部</th>
            <th>零售6部</th>
            <th>零售7部</th>
            <th>零售8部</th>
            <th>零售9部</th>
            <th>零售10部</th>
            <th>总计</th>
        </tr>--%>
        </thead>
        <tbody id="body">
        </tbody>
    </table>
</div>
</body>
</html>
<script type="text/javascript">
    $(function () {
        $('#endDate1').datetimepicker({
            format: "yyyy-mm-dd hh:00",
            autoclose: true,
            minView:1
        });
        $('.input-date').datetimepicker({
            format: "yyyy-mm-dd",
            autoclose: true,
            minView: 2
        });
        var date1 = new Date();
        var date2 = new Date();
        var date3 = new Date();
        date2.setDate(date1.getDate() - 1);
        date3.setDate(date1.getDate() - 7);
        var month1 = date1.getMonth() < 9 ? ("0" + (date1.getMonth() + 1)) : (date1.getMonth() + 1);
        var month2 = date2.getMonth() < 9 ? ("0" + (date2.getMonth() + 1)) : (date2.getMonth() + 1);
        var month3 = date3.getMonth() < 9 ? ("0" + (date3.getMonth() + 1)) : (date3.getMonth() + 1);
        $("#endDate1").val(date1.getFullYear() + "-" + month1 + "-" + (date1.getDate() < 10 ? ("0" + date1.getDate()) : date1.getDate()) + " " + date1.getHours() + ":00");
        $("#endDate2").val(date2.getFullYear() + "-" + month2 + "-" + (date2.getDate() < 10 ? ("0" + date2.getDate()) : date2.getDate()));
        $("#endDate3").val(date3.getFullYear() + "-" + month3 + "-" + (date3.getDate() < 10 ? ("0" + date3.getDate()) : date3.getDate()));
        var loadData = function () {
            var s = layer.load(0, {
                shade: [0.2, '#fff'] //0.1透明度的白色背景
            });
            $.post("weixin/WXActivity/PostHandler.ashx",
                {
                    "action": "TimeAnalysisReport2",
                    "EndDate1": $("#endDate1").val(),
                    "EndDate2": $("#endDate2").val(),
                    "EndDate3": $("#endDate3").val(),
                    "ShopType": $("#shopType").val(),
                },
                function (data) {
                    if (data.Success == true) {
                        var title = $("#title");
                        var tbody = $("#body");
                        tbody.empty();
                        title.empty();
                        if (data.Data.length > 1) {

                            var title_html_ext = "<tr>";
                            title_html_ext += "<th rowspan='2'>指标</th>";
                            title_html_ext += "<th rowspan='2'>日期</th>";
                            title_html_ext += "<th rowspan='2'>星期</th>";
                            var title_html = "<tr>";
                            data.Data.map(function(d) {
                                switch (d.OperationAreaName) {
                                    case "商品1部": title_html_ext += "<th>粤琼闽桂</th>";
                                        title_html += "<th class='oaName'>" + d.OperationAreaName + "</th>";
                                        break;
                                    case "商品2部": title_html_ext += "<th>黔滇川渝</th>";
                                        title_html += "<th class='oaName'>" + d.OperationAreaName + "</th>";
                                        break;
                                    case "商品3部": title_html_ext += "<th>湘鄂皖苏浙赣</th>";
                                        title_html += "<th class='oaName'>" + d.OperationAreaName + "</th>";
                                        break;
                                    case "商品4部": title_html_ext += "<th>豫鲁</th>";
                                        title_html += "<th class='oaName'>" + d.OperationAreaName + "</th>";
                                        break;
                                    case "商品5部": title_html_ext += "<th>晋京津冀</th>";
                                        title_html += "<th class='oaName'>" + d.OperationAreaName + "</th>";
                                        break;
                                    case "商品6部": title_html_ext += "<th>甘宁青陕辽新藏黑吉</th>";
                                        title_html += "<th class='oaName'>" + d.OperationAreaName + "</th>";
                                        break;
                                    default: title_html_ext += "<th rowspan='2' class='taotalName'>" + d.OperationAreaName + "</th>";
                                        break;
                                }
                            });
                            title_html_ext += "</tr>";
                            title_html += "</th>";
                            title.append(title_html_ext);
                            title.append(title_html);
                            
                            var html = "";
                            var lastweek = data.Data[0].group[0][0].SaleDate;
                            var lastweekWeek = data.Data[0].group[0][0].Week;
                            var yestorday = data.Data[0].group[1][0].SaleDate;
                            var yestordayWeek = data.Data[0].group[1][0].Week;
                            var today = data.Data[0].group[2][0].SaleDate;
                            var todayWeek = data.Data[0].group[2][0].Week;

                            var shopCountL = "<tr>";
                            var shopCountY = "<tr>";
                            var shopCountT = "<tr>";
                            var saleAmountL = "<tr>";
                            var saleAmountY = "<tr>";
                            var saleAmountT = "<tr>";
                            var saleAmountN = "<tr>";
                            var saleAmountW = "<tr>";
                            var saleQtyL = "<tr>";
                            var saleQtyY = "<tr>";
                            var saleQtyT = "<tr>";
                            var saleQtyN = "<tr>";
                            var saleQtyW = "<tr>";
                            var saleCountL = "<tr>";
                            var saleCountY = "<tr>";
                            var saleCountT = "<tr>";
                            var saleCountN = "<tr>";
                            var saleCountW = "<tr>";
                            var kpiQtyL = "<tr>";
                            var kpiQtyY = "<tr>";
                            var kpiQtyT = "<tr>";
                            var kpiQtyN = "<tr>";
                            var kpiQtyW = "<tr>";
                            var saleKdjL = "<tr>";
                            var saleKdjY = "<tr>";
                            var saleKdjT = "<tr>";
                            var saleKdjN = "<tr>";
                            var saleKdjW = "<tr>";
                            var closingL = "<tr>";
                            var closingY = "<tr>";
                            var closingT = "<tr>";
                            var closingN = "<tr>";
                            var closingW = "<tr>";
                            var salelDvL = "<tr>";
                            var salelDvY = "<tr>";
                            var salelDvT = "<tr>";
                            var salelDvN = "<tr>";
                            var salelDvW = "<tr>";
                            var discountL = "<tr>";
                            var discountY = "<tr>";
                            var discountT = "<tr>";
                            var discountN = "<tr>";
                            var discountW = "<tr>";
                            var saleJdjL = "<tr>";
                            var saleJdjY = "<tr>";
                            var saleJdjT = "<tr>";
                            var saleJdjN = "<tr>";
                            var saleJdjW = "<tr>";

                            shopCountL += "<td id= 'ShopCount' rowspan= '3' colspan= '1'>店铺数</td >";
                            shopCountL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            shopCountL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            shopCountY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            shopCountY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            shopCountT += "<td class='today' rowspan='1' >" + today + "</td>";
                            shopCountT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";

                            saleAmountL += "<td id='SaleAmount' rowspan='5' >销售金额</td>";
                            saleAmountL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            saleAmountL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            saleAmountY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            saleAmountY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            saleAmountT += "<td class='today' rowspan='1' >" + today + "</td>";
                            saleAmountT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";
                            saleAmountN += "<td class='lastweek_NeighborhoodCom black' rowspan='1' colspan='2' >临日对比</td>";
                            saleAmountW += "<td class='lastweek_WeekCom black' rowspan='1' colspan='2' >周星期对比</td>";

                            saleQtyL += "<td id='SaleQty' rowspan='5' >销售数量</td>";
                            saleQtyL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            saleQtyL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            saleQtyY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            saleQtyY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            saleQtyT += "<td class='today' rowspan='1' >" + today + "</td>";
                            saleQtyT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";
                            saleQtyN +=
                                "<td class='lastweek_NeighborhoodCom black' rowspan='1' colspan='2' >临日对比</td>";
                            saleQtyW += "<td class='lastweek_WeekCom black' rowspan='1' colspan='2' >周星期对比</td>";

                            saleCountL += "<td id='SaleCount' rowspan='5' >销售单数</td>";
                            saleCountL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            saleCountL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            saleCountY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            saleCountY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            saleCountT += "<td class='today' rowspan='1' >" + today + "</td>";
                            saleCountT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";
                            saleCountN +=
                                "<td class='lastweek_NeighborhoodCom black' rowspan='1' colspan='2' >临日对比</td>";
                            saleCountW +=
                                "<td class='lastweek_WeekCom black' rowspan='1' colspan='2'  >周星期对比</td>";

                            kpiQtyL += "<td id='KpiQty' rowspan='5' >客流量</td>";
                            kpiQtyL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            kpiQtyL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            kpiQtyY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            kpiQtyY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            kpiQtyT += "<td class='today' rowspan='1' >" + today + "</td>";
                            kpiQtyT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";
                            kpiQtyN += "<td class='lastweek_NeighborhoodCom black' rowspan='1' colspan='2' >临日对比</td>";
                            kpiQtyW += "<td class='lastweek_WeekCom black' rowspan='1' colspan='2' >周星期对比</td>";

                            saleKdjL += "<td id='SaleKdjL' rowspan='5' >客单价</td>";
                            saleKdjL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            saleKdjL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            saleKdjY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            saleKdjY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            saleKdjT += "<td class='today' rowspan='1' >" + today + "</td>";
                            saleKdjT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";
                            saleKdjN +=
                                "<td class='lastweek_NeighborhoodCom black' rowspan='1'  colspan='2' >临日对比</td>";
                            saleKdjW += "<td class='lastweek_WeekCom black' rowspan='1'  colspan='2' >周星期对比</td>";

                            closingL += "<td id='Closing' rowspan='5' >成交率</td>";
                            closingL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            closingL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            closingY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            closingY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            closingT += "<td class='today' rowspan='1' >" + today + "</td>";
                            closingT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";
                            closingN +=
                                "<td class='lastweek_NeighborhoodCom black' rowspan='1' colspan='2'  >临日对比</td>";
                            closingW += "<td class='lastweek_WeekCom black' rowspan='1'  colspan='2' >周星期对比</td>";

                            salelDvL += "<td id='SalelDv' rowspan='5' >连带率（服鞋）</td>";
                            salelDvL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            salelDvL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            salelDvY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            salelDvY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            salelDvT += "<td class='today' rowspan='1' >" + today + "</td>";
                            salelDvT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";
                            salelDvN += "<td class='lastweek_NeighborhoodCom black' rowspan='1' colspan='2' >临日对比</td>";
                            salelDvW += "<td class='lastweek_WeekCom black' rowspan='1' colspan='2' >周星期对比</td>";

                            discountL += "<td id='Discount' rowspan='5' >折扣</td>";
                            discountL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            discountL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            discountY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            discountY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            discountT += "<td class='today' rowspan='1' >" + today + "</td>";
                            discountT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";
                            discountN += "<td class='lastweek_NeighborhoodCom black' rowspan='1' colspan='2' >临日对比</td>";
                            discountW += "<td class='lastweek_WeekCom black' rowspan='1' colspan='2' >周星期对比</td>";

                            saleJdjL += "<td id='SaleJdj' rowspan='5' >件单价(鞋服)</td>";
                            saleJdjL += "<td class='lastweek' rowspan='1' >" + lastweek + "</td>";
                            saleJdjL += "<td class='lastweekWeek' rowspan='1' >" + lastweekWeek + "</td>";
                            saleJdjY += "<td class='yestorday' rowspan='1' >" + yestorday + "</td>";
                            saleJdjY += "<td class='yestordayWeek' rowspan='1' >" + yestordayWeek + "</td>";
                            saleJdjT += "<td class='today' rowspan='1' >" + today + "</td>";
                            saleJdjT += "<td class='todayWeek' rowspan='1' >" + todayWeek + "</td>";
                            saleJdjN += "<td class='lastweek_NeighborhoodCom black' rowspan='1' colspan='2' >临日对比</td>";
                            saleJdjW += "<td class='lastweek_WeekCom black' rowspan='1' colspan='2' >周星期对比</td>";

                            var thead = $(".oaName");
                            thead.push($(".taotalName")[0]);

                            thead.each(function() {
                                var $this = this;
                                data.Data.map(function(item) {
                                    if (item.OperationAreaName == $this.textContent) {
                                        shopCountL += "<td class='shopCountL' rowspan='1' >" +
                                            (item.group[0][0].ShopCount || ' ') +
                                            "</td>";
                                        shopCountY += "<td class='shopCountY' rowspan='1' >" +
                                            (item.group[1][0].ShopCount || ' ') +
                                            "</td>";
                                        shopCountT += "<td class='shopCountT' rowspan='1' >" +
                                            (item.group[2][0].ShopCount || ' ') +
                                            "</td>";

                                        saleAmountL += "<td class='saleAmountL' rowspan='1' >" +
                                            (Y.checkNull(item.group[0][0].SaleAmount) ? ' ' : (item.group[0][0].SaleAmount.toFixed(0))) +
                                            "</td>";
                                        saleAmountY += "<td class='saleAmountY' rowspan='1' >" +
                                            (Y.checkNull(item.group[1][0].SaleAmount) ? ' ' : (item.group[1][0].SaleAmount.toFixed(0))) +
                                            "</td>";
                                        saleAmountT += "<td class='saleAmountT' rowspan='1' >" +
                                            (Y.checkNull(item.group[2][0].SaleAmount) ? ' ' : (item.group[2][0].SaleAmount.toFixed(0))) +
                                            "</td>";

                                        var nSaleAmount = item.group[0][0].NeighborhoodCom_SaleAmount.toFixed(1);
                                        var wSaleAmount = item.group[0][0].WeekCom_SaleAmount.toFixed(1);
                                        if (nSaleAmount < 0) {
                                            saleAmountN += "<td class='saleAmountN red' rowspan='1' >" + nSaleAmount + "%</td>";
                                        } else {
                                            saleAmountN += "<td class='saleAmountN black' rowspan='1' >" + nSaleAmount + "%</td>";
                                        }
                                        if (wSaleAmount < 0) {
                                            saleAmountW += "<td class='saleAmountW red' rowspan='1' >" + wSaleAmount + "%</td>";
                                        } else {
                                            saleAmountW += "<td class='saleAmountW black' rowspan='1' >" + wSaleAmount + "%</td>";
                                        }

                                        saleQtyL += "<td class='saleQtyL' rowspan='1' >" +
                                            (item.group[0][0].SaleQty || ' ') +
                                            "</td>";
                                        saleQtyY += "<td class='saleQtyY' rowspan='1' >" +
                                            (item.group[1][0].SaleQty || ' ') +
                                            "</td>";
                                        saleQtyT += "<td class='saleQtyT' rowspan='1' >" +
                                            (item.group[2][0].SaleQty || ' ') +
                                            "</td>";

                                        var nSaleQty = item.group[0][0].NeighborhoodCom_SaleQty.toFixed(1);
                                        var wSaleQty = item.group[0][0].WeekCom_SaleQty.toFixed(1);
                                        if (nSaleQty < 0) {
                                            saleQtyN += "<td class='saleQtyN red' rowspan='1' >" +
                                                nSaleQty +
                                                "%</td>";
                                        } else {
                                            saleQtyN += "<td class='saleQtyN black' rowspan='1' >" +
                                                nSaleQty +
                                                "%</td>";
                                        }
                                        if (wSaleQty < 0) {
                                            saleQtyW += "<td class='saleQtyW red' rowspan='1' >" +
                                                wSaleQty +
                                                "%</td>";
                                        } else {
                                            saleQtyW += "<td class='saleQtyW black' rowspan='1' >" +
                                                wSaleQty +
                                                "%</td>";
                                        }

                                        saleCountL += "<td class='saleCountL' rowspan='1' >" +
                                            (item.group[0][0].SaleCount || ' ') +
                                            "</td>";
                                        saleCountY += "<td class='saleCountY' rowspan='1' >" +
                                            (item.group[1][0].SaleCount || ' ') +
                                            "</td>";
                                        saleCountT += "<td class='saleCountT' rowspan='1' >" +
                                            (item.group[2][0].SaleCount || ' ') +
                                            "</td>";

                                        var nSaleCount =
                                            item.group[0][0].NeighborhoodCom_SaleCount.toFixed(1);
                                        var wSaleCount = item.group[0][0].WeekCom_SaleCount.toFixed(1);
                                        if (nSaleCount < 0) {
                                            saleCountN += "<td class='saleCountN red' rowspan='1' >" +
                                                nSaleCount +
                                                "%</td>";
                                        } else {
                                            saleCountN += "<td class='saleCountN black' rowspan='1' >" +
                                                nSaleCount +
                                                "%</td>";
                                        }
                                        if (wSaleCount < 0) {
                                            saleCountW += "<td class='saleCountW red' rowspan='1' >" +
                                                wSaleCount +
                                                "%</td>";
                                        } else {
                                            saleCountW += "<td class='saleCountW black' rowspan='1' >" +
                                                wSaleCount +
                                                "%</td>";
                                        }

                                        kpiQtyL += "<td class='kpiQtyL' rowspan='1' >" +
                                            (item.group[0][0].KpiQty || ' ') +
                                            "</td>";
                                        kpiQtyY += "<td class='kpiQtyY' rowspan='1' >" +
                                            (item.group[1][0].KpiQty || ' ') +
                                            "</td>";
                                        kpiQtyT += "<td class='kpiQtyT' rowspan='1' >" +
                                            (item.group[2][0].KpiQty || ' ') +
                                            "</td>";

                                        var nKpiQty = item.group[0][0].NeighborhoodCom_KpiQty.toFixed(1);
                                        var wKpiQty = item.group[0][0].WeekCom_KpiQty.toFixed(1);
                                        if (nKpiQty < 0) {
                                            kpiQtyN += "<td class='kpiQtyN red' rowspan='1' >" +
                                                nKpiQty +
                                                "%</td>";
                                        } else {
                                            kpiQtyN += "<td class='kpiQtyN black' rowspan='1' >" +
                                                nKpiQty +
                                                "%</td>";
                                        }
                                        if (wKpiQty < 0) {
                                            kpiQtyW += "<td class='kpiQtyW red' rowspan='1' >" +
                                                wKpiQty +
                                                "%</td>";
                                        } else {
                                            kpiQtyW += "<td class='kpiQtyW black' rowspan='1' >" +
                                                wKpiQty +
                                                "%</td>";
                                        }

                                        saleKdjL += "<td class='saleKdjL' rowspan='1' >" +
                                            (Y.checkNull(item.group[0][0].SaleKdj) ? ' ' : (item.group[0][0].SaleKdj.toFixed(0))) +
                                            "</td>";
                                        saleKdjY += "<td class='saleKdjY' rowspan='1' >" +
                                            (Y.checkNull(item.group[1][0].SaleKdj) ? ' ' : (item.group[1][0].SaleKdj.toFixed(0))) +
                                            "</td>";
                                        saleKdjT += "<td class='saleKdjT' rowspan='1' >" +
                                            (Y.checkNull(item.group[2][0].SaleKdj) ? ' ' : (item.group[2][0].SaleKdj.toFixed(0))) +
                                            "</td>";

                                        var nSaleKdj = item.group[0][0].NeighborhoodCom_SaleKdj.toFixed(1);
                                        var wSaleKdj = item.group[0][0].WeekCom_SaleKdj.toFixed(1);
                                        if (nSaleKdj < 0) {
                                            saleKdjN += "<td class='saleKdjN red' rowspan='1' >" +
                                                nSaleKdj +
                                                "%</td>";
                                        } else {
                                            saleKdjN += "<td class='saleKdjN black' rowspan='1' >" +
                                                nSaleKdj +
                                                "%</td>";
                                        }
                                        if (wSaleKdj < 0) {
                                            saleKdjW += "<td class='saleKdjW red' rowspan='1' >" +
                                                wSaleKdj +
                                                "%</td>";
                                        } else {
                                            saleKdjW += "<td class='saleKdjW black' rowspan='1' >" +
                                                wSaleKdj +
                                                "%</td>";
                                        }

                                        closingL += "<td class='closingL' rowspan='1' >" +
                                            (Y.checkNull(item.group[0][0].Closing) ? ' ' : (item.group[0][0].Closing.toFixed(1) + '%')) +
                                            "</td>";
                                        closingY += "<td class='closingY' rowspan='1' >" +
                                            (Y.checkNull(item.group[1][0].Closing) ? ' ' : (item.group[1][0].Closing.toFixed(1) + '%')) +
                                            "</td>";
                                        closingT += "<td class='closingT' rowspan='1' >" +
                                            (Y.checkNull(item.group[2][0].Closing) ? ' ' : (item.group[2][0].Closing.toFixed(1) + '%')) +
                                            "</td>";

                                        var nClosing = item.group[0][0].NeighborhoodCom_Closing.toFixed(1);
                                        var wClosing = item.group[0][0].WeekCom_Closing.toFixed(1);
                                        if (nClosing < 0) {
                                            closingN += "<td class='closingN red' rowspan='1' >" + nClosing + "%</td>";
                                        } else {
                                            closingN += "<td class='closingN black' rowspan='1' >" + nClosing + "%</td>";
                                        }
                                        if (wClosing < 0) {
                                            closingW += "<td class='closingW red' rowspan='1' >" + wClosing + "%</td>";
                                        } else {
                                            closingW += "<td class='closingW black' rowspan='1' >" + wClosing + "%</td>";
                                        }

                                        salelDvL += "<td class='salelDvL' rowspan='1' >" +
                                            (Y.checkNull(item.group[0][0].SalelDv) ? ' ' : (item.group[0][0].SalelDv.toFixed(1) )) +
                                            "</td>";
                                        salelDvY += "<td class='salelDvY' rowspan='1' >" +
                                            (Y.checkNull(item.group[1][0].SalelDv) ? ' ' : (item.group[1][0].SalelDv.toFixed(1) )) +
                                            "</td>";
                                        salelDvT += "<td class='salelDvT' rowspan='1' >" +
                                            (Y.checkNull(item.group[2][0].SalelDv) ? ' ' : (item.group[2][0].SalelDv.toFixed(1) )) +
                                            "</td>";

                                        var nSalelDv = item.group[0][0].NeighborhoodCom_SalelDv.toFixed(1);
                                        var wSalelDv = item.group[0][0].WeekCom_SalelDv.toFixed(1);
                                        if (nSalelDv < 0) {
                                            salelDvN += "<td class='salelDvN red' rowspan='1' >" + nSalelDv + "%</td>";
                                        } else {
                                            salelDvN += "<td class='salelDvN black' rowspan='1' >" + nSalelDv + "%</td>";
                                        }
                                        if (wSalelDv < 0) {
                                            salelDvW += "<td class='salelDvW red' rowspan='1' >" + wSalelDv + "%</td>";
                                        } else {
                                            salelDvW += "<td class='salelDvW black' rowspan='1' >" + wSalelDv + "%</td>";
                                        }

                                        discountL += "<td class='discountL' rowspan='1' >" +
                                            (Y.checkNull(item.group[0][0].Discount) ? ' ' : ((item.group[0][0].Discount*100).toFixed(1)) + "%") +
                                            "</td>";
                                        discountY += "<td class='discountY' rowspan='1' >" +
                                            (Y.checkNull(item.group[1][0].Discount) ? ' ' : ((item.group[1][0].Discount * 100).toFixed(1)) + "%") +
                                            "</td>";
                                        discountT += "<td class='discountT' rowspan='1' >" +
                                            (Y.checkNull(item.group[2][0].Discount) ? ' ' : ((item.group[2][0].Discount * 100).toFixed(1))+"%") +
                                            "</td>";

                                        var nDiscount = item.group[0][0].NeighborhoodCom_Discount.toFixed(1);
                                        var wDiscount = item.group[0][0].WeekCom_Discount.toFixed(1);
                                        if (nDiscount < 0) {
                                            discountN += "<td class='discountN red' rowspan='1' >" + nDiscount + "%</td>";
                                        } else {
                                            discountN += "<td class='discountN black' rowspan='1' >" + nDiscount + "%</td>";
                                        }
                                        if (wDiscount < 0) {
                                            discountW += "<td class='discountW red' rowspan='1' >" + wDiscount + "%</td>";
                                        } else {
                                            discountW += "<td class='discountW black' rowspan='1' >" + wDiscount + "%</td>";
                                        }

                                        saleJdjL += "<td class='saleJdjL' rowspan='1' >" +
                                            (Y.checkNull(item.group[0][0].SaleJdj) ? ' ' : (item.group[0][0].SaleJdj.toFixed(0))) +
                                            "</td>";
                                        saleJdjY += "<td class='saleJdjY' rowspan='1' >" +
                                            (Y.checkNull(item.group[1][0].SaleJdj) ? ' ' : (item.group[1][0].SaleJdj.toFixed(0))) +
                                            "</td>";
                                        saleJdjT += "<td class='saleJdjT' rowspan='1' >" +
                                            (Y.checkNull(item.group[2][0].SaleJdj) ? ' ' : (item.group[2][0].SaleJdj.toFixed(0))) +
                                            "</td>";

                                        var nSaleJdj = item.group[0][0].NeighborhoodCom_SaleJdj.toFixed(1);
                                        var wSaleJdj = item.group[0][0].WeekCom_SaleJdj.toFixed(1);
                                        if (nSaleJdj < 0) {
                                            saleJdjN += "<td class='saleJdjN red' rowspan='1' >" + nSaleJdj + "%</td>";
                                        } else {
                                            saleJdjN += "<td class='saleJdjN black' rowspan='1' >" + nSaleJdj + "%</td>";
                                        }
                                        if (wSaleJdj < 0) {
                                            saleJdjW += "<td class='saleJdjW red' rowspan='1' >" + wSaleJdj + "%</td>";
                                        } else {
                                            saleJdjW += "<td class='saleJdjW black' rowspan='1' >" + wSaleJdj + "%</td>";
                                        }
                                    }
                                });
                            });

                            shopCountL += "</tr>";
                            shopCountY += "</tr>";
                            shopCountT += "</tr>";

                            saleAmountL += "</tr>";
                            saleAmountY += "</tr>";
                            saleAmountT += "</tr>";
                            saleAmountN += "</tr>";
                            saleAmountW += "</tr>";

                            saleQtyL += "</tr>";
                            saleQtyY += "</tr>";
                            saleQtyT += "</tr>";
                            saleQtyN += "</tr>";
                            saleQtyW += "</tr>";

                            saleCountL += "</tr>";
                            saleCountY += "</tr>";
                            saleCountT += "</tr>";
                            saleCountN += "</tr>";
                            saleCountW += "</tr>";

                            kpiQtyL += "</tr>";
                            kpiQtyY += "</tr>";
                            kpiQtyT += "</tr>";
                            kpiQtyN += "</tr>";
                            kpiQtyW += "</tr>";

                            saleKdjL += "</tr>";
                            saleKdjY += "</tr>";
                            saleKdjT += "</tr>";
                            saleKdjN += "</tr>";
                            saleKdjW += "</tr>";

                            closingL += "</tr>";
                            closingY += "</tr>";
                            closingT += "</tr>";
                            closingN += "</tr>";
                            closingW += "</tr>";

                            salelDvL += "</tr>";
                            salelDvY += "</tr>";
                            salelDvT += "</tr>";
                            salelDvN += "</tr>";
                            salelDvW += "</tr>";

                            discountL += "</tr>";
                            discountY += "</tr>";
                            discountT += "</tr>";
                            discountN += "</tr>";
                            discountW += "</tr>";

                            saleJdjL += "</tr>";
                            saleJdjY += "</tr>";
                            saleJdjT += "</tr>";
                            saleJdjN += "</tr>";
                            saleJdjW += "</tr>";

                            html += shopCountL +
                                shopCountY +
                                shopCountT +
                                saleAmountL +
                                saleAmountY +
                                saleAmountT +
                                saleAmountN +
                                saleAmountW +
                                saleQtyL +
                                saleQtyY +
                                saleQtyT +
                                saleQtyN +
                                saleQtyW +
                                saleCountL +
                                saleCountY +
                                saleCountT +
                                saleCountN +
                                saleCountW +
                                kpiQtyL +
                                kpiQtyY +
                                kpiQtyT +
                                kpiQtyN +
                                kpiQtyW +
                                saleKdjL +
                                saleKdjY +
                                saleKdjT +
                                saleKdjN +
                                saleKdjW +
                                closingL +
                                closingY +
                                closingT +
                                closingN +
                                closingW +
                                salelDvL +
                                salelDvY +
                                salelDvT +
                                salelDvN +
                                salelDvW +
                                discountL +
                                discountY +
                                discountT +
                                discountN +
                                discountW +
                                saleJdjL +
                                saleJdjY +
                                saleJdjT +
                                saleJdjN +
                                saleJdjW;
                            tbody.append(html);
                        } else {
                            var emptyTable = "<tr><td colspan='11'>暂无数据</td></tr>";
                            tbody.append(emptyTable);
                        }
                    }
                    layer.close(s);
                });
        }
        $(".btn-success").on("click", function () {
            var endDate1 = $("#endDate1").val();
            var endDate2 = $("#endDate2").val();
            var endDate3 = $("#endDate3").val();
            if (Y.checkNull(endDate1) || Y.checkNull(endDate2) || Y.checkNull(endDate3)) {
                alert("请选择日期!");
                return false;
            }
            if (endDate1.substring(0, 10) == endDate2 || endDate1.substring(0, 10) == endDate3) {
                alert("请选择三个不同的日期!");
                return false;
            }
            loadData();
        });
    });
</script>

